package com.ming.interview;

import java.util.Scanner;

/**
 * @Description 求1+2!+3!+…+20!的和
 * @Author ye.ming
 * @Date Created in 2019/8/26
 */
public class Main19 {

    public static void main(String[] args) {

        Scanner scc = new Scanner(System.in);

        System.out.println("请输入要计算的N的值：");
        int n = scc.nextInt();

        int sum = 0, temp = 1;
        for (int i = 0; i < n; i++) {
            temp  = temp * (i+1);
            sum += temp;
        }
        System.out.println(sum);
    }


    private static void m1(int m, int n) {

    }


}
